import React, { memo, useState, useEffect } from "react";
import { View } from "@tarojs/components";
import { Swiper, SwiperItem, Image } from '@antmjs/vantui'
import Taro from '@tarojs/taro';

import './index.scss'


const HomeSwiper = (props) => {

  const { banners = [] } = props
  const goAnscer = (index) => {
    if (index == 1) {
      Taro.navigateTo({
        url: '/xiaoyiAccExam/index',
      })
    }

  }
  return (
    <View className='header-swiper' >
      <Swiper
        touchable
        initPage={0}
        height={136}
        paginationColor='#426543'
        autoPlay='3000'
        paginationVisible

      >
        {
          banners.length && banners.map((item, index) => (
            <SwiperItem key={item?.id} >
              <Image src={item.imageUrl} onClick={() => goAnscer(index)} fit='cover' width='100%' height='100%' />
            </SwiperItem>
          ))
        }

      </Swiper>
    </View >

  );
};

export default memo(HomeSwiper);
